package com.platform.dto;

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * description:部门树节点。
 * 在TreeNode基础上增加部门的范围类型
 *
 * @author qy
 * @version v1.0
 * @date Created in 2020/10/16
 */
@Data
public class DepartNode implements Serializable {
    private String id;

    private String code;

    private String text;

    private String type;

    private String regionCode;

    private List<? extends DepartNode> children = new ArrayList<>();

    public DepartNode() {
    }

    public static DepartNode of(String id, String code, String text,
                                String regionCode, String type, List<? extends DepartNode> children) {
        DepartNode node = new DepartNode();
        node.setId(id);
        node.setCode(code);
        node.setText(text);
        node.setRegionCode(regionCode);
        node.setType(type);
        node.setChildren(children);
        return node;
    }
}
